package com.zj.service;

import com.zj.dao.MyuserDao;
import com.zj.dao.UserDao2;
import com.zj.domain.Myuser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class MyUserService implements IuserService {
    @Autowired
    private UserDao2 myuserDao;
    @Override
    @Transactional
    public int addUser(Myuser user) {
        int res = myuserDao.insert(user);
//        int a=1/0;
        return res;
    }



    @Override
    @Transactional(readOnly = true)
    public Myuser selectUserById(Integer id) {
        Myuser res = myuserDao.selectByPrimaryKey(id);
        int a=1/0;
        return res;
    }

    @Override
    @Transactional(readOnly = true)
    public Myuser selectUser(Integer id) {
        Myuser res = myuserDao.selectByIDno(id);
//        int a=1/0;
        return res;
    }
}
